﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:49
 ******************************************************************************/

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
      using RDIFramework.Utilities;

     /// <summary>
     /// CiMessageEntity
     /// 消息表
     ///
     /// 修改纪录
     ///
     ///		2012-03-02 版本：1.0 EricHu 创建主键。
     ///
     /// 版本：1.0
     ///
     /// <author>
     ///		<name>EricHu</name>
     ///		<date>2012-03-02</date>
     /// </author>
     /// </summary>
    [Serializable]
    public partial class CiMessageEntity
    {
        private int? id = null;
        /// <summary>
        /// 主键
        /// </summary>
        public int? Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        private int? parentId = null;
        /// <summary>
        /// 父亲节点主键
        /// </summary>
        public int? ParentId
        {
            get
            {
                return this.parentId;
            }
            set
            {
                this.parentId = value;
            }
        }

        private String functionId = string.Empty;
        /// <summary>
        /// 功能分类主键，Send发送、Receiver接收
        /// </summary>
        public String FunctionId
        {
            get
            {
                return this.functionId;
            }
            set
            {
                this.functionId = value;
            }
        }

        private String categoryId = string.Empty;
        /// <summary>
        /// 分类主键
        /// </summary>
        public String CategoryId
        {
            get
            {
                return this.categoryId;
            }
            set
            {
                this.categoryId = value;
            }
        }

        private String objectId = string.Empty;
        /// <summary>
        /// 唯一识别主键
        /// </summary>
        public String ObjectId
        {
            get
            {
                return this.objectId;
            }
            set
            {
                this.objectId = value;
            }
        }

        private String title = string.Empty;
        /// <summary>
        /// 主题
        /// </summary>
        public String Title
        {
            get
            {
                return this.title;
            }
            set
            {
                this.title = value;
            }
        }

        private String content = string.Empty;
        /// <summary>
        /// 内容
        /// </summary>
        public String Content
        {
            get
            {
                return this.content;
            }
            set
            {
                this.content = value;
            }
        }

        private int? receiverId = null;
        /// <summary>
        /// 接收者主键
        /// </summary>
        public int? ReceiverId
        {
            get
            {
                return this.receiverId;
            }
            set
            {
                this.receiverId = value;
            }
        }

        private String receiverRealname = string.Empty;
        /// <summary>
        /// 接收着姓名
        /// </summary>
        public String ReceiverRealname
        {
            get
            {
                return this.receiverRealname;
            }
            set
            {
                this.receiverRealname = value;
            }
        }

        private int? isNew = null;
        /// <summary>
        /// 是否新信息
        /// </summary>
        public int? IsNew
        {
            get
            {
                return this.isNew;
            }
            set
            {
                this.isNew = value;
            }
        }

        private int? readCount = 0;
        /// <summary>
        /// 被阅读次数
        /// </summary>
        public int? ReadCount
        {
            get
            {
                return this.readCount;
            }
            set
            {
                this.readCount = value;
            }
        }

        private DateTime? readDate = null;
        /// <summary>
        /// 阅读日期
        /// </summary>
        public DateTime? ReadDate
        {
            get
            {
                return this.readDate;
            }
            set
            {
                this.readDate = value;
            }
        }

        private String targetURL = string.Empty;
        /// <summary>
        /// 消息的指向网页页面
        /// </summary>
        public String TargetURL
        {
            get
            {
                return this.targetURL;
            }
            set
            {
                this.targetURL = value;
            }
        }

        private String iPAddress = string.Empty;
        /// <summary>
        /// IP地址
        /// </summary>
        public String IPAddress
        {
            get
            {
                return this.iPAddress;
            }
            set
            {
                this.iPAddress = value;
            }
        }

        private int? deleteMark = 0;
        /// <summary>
        /// 删除标志
        /// </summary>
        public int? DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        private int? enabled = 1;
        /// <summary>
        /// 有效
        /// </summary>
        public int? Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        private String description = string.Empty;
        /// <summary>
        /// 描述
        /// </summary>
        public String Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        private int? sortCode = null;
        /// <summary>
        /// 排序码
        /// </summary>
        public int? SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        private DateTime? createOn = DateTime.Now;
        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateOn
        {
            get
            {
                return this.createOn;
            }
            set
            {
                this.createOn = value;
            }
        }

        private String createUserId = string.Empty;
        /// <summary>
        /// 创建用户主键
        /// </summary>
        public String CreateUserId
        {
            get
            {
                return this.createUserId;
            }
            set
            {
                this.createUserId = value;
            }
        }

        private String createBy = string.Empty;
        /// <summary>
        /// 创建用户
        /// </summary>
        public String CreateBy
        {
            get
            {
                return this.createBy;
            }
            set
            {
                this.createBy = value;
            }
        }

        private DateTime? modifiedOn = null;
        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? ModifiedOn
        {
            get
            {
                return this.modifiedOn;
            }
            set
            {
                this.modifiedOn = value;
            }
        }

        private String modifyUserId = string.Empty;
        /// <summary>
        /// 修改用户主键
        /// </summary>
        public String ModifyUserId
        {
            get
            {
                return this.modifyUserId;
            }
            set
            {
                this.modifyUserId = value;
            }
        }

        private String modifiedBy = string.Empty;
        /// <summary>
        /// 修改用户
        /// </summary>
        public String ModifiedBy
        {
            get
            {
                return this.modifiedBy;
            }
            set
            {
                this.modifiedBy = value;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public CiMessageEntity()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public CiMessageEntity(DataRow dataRow)
        {
            this.GetFrom(dataRow);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public CiMessageEntity(IDataReader dataReader)
        {
            this.GetFrom(dataReader);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public CiMessageEntity(DataTable dataTable)
        {
            this.GetFrom(dataTable);
        }

        /// <summary>
        /// 从数据表读取
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public CiMessageEntity GetFrom(DataTable dataTable)
        {
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                return null;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                this.GetFrom(dataRow);
                break;
            }
            return this;
        }

        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public CiMessageEntity GetFrom(DataRow dataRow)
        {
            this.Id = BusinessLogic.ConvertToInt(dataRow[CiMessageTable.FieldId]);
            this.ParentId = BusinessLogic.ConvertToInt(dataRow[CiMessageTable.FieldParentId]);
            this.FunctionId = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldFunctionId]);
            this.CategoryId = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldCategoryId]);
            this.ObjectId = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldObjectId]);
            this.Title = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldTitle]);
            this.Content = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldContent]);
            this.ReceiverId = BusinessLogic.ConvertToInt(dataRow[CiMessageTable.FieldReceiverId]);
            this.ReceiverRealname = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldReceiverRealname]);
            this.IsNew = BusinessLogic.ConvertToInt(dataRow[CiMessageTable.FieldIsNew]);
            this.ReadCount = BusinessLogic.ConvertToInt(dataRow[CiMessageTable.FieldReadCount]);
            this.ReadDate = BusinessLogic.ConvertToDateTime(dataRow[CiMessageTable.FieldReadDate]);
            this.TargetURL = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldTargetURL]);
            this.IPAddress = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldIPAddress]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[CiMessageTable.FieldDeleteMark]);
            this.Enabled = BusinessLogic.ConvertToInt(dataRow[CiMessageTable.FieldEnabled]);
            this.Description = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldDescription]);
            this.SortCode = BusinessLogic.ConvertToInt(dataRow[CiMessageTable.FieldSortCode]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[CiMessageTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[CiMessageTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[CiMessageTable.FieldModifiedBy]);
            return this;
        }

        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public CiMessageEntity GetFrom(IDataReader dataReader)
        {
            this.Id = BusinessLogic.ConvertToInt(dataReader[CiMessageTable.FieldId]);
            this.ParentId = BusinessLogic.ConvertToInt(dataReader[CiMessageTable.FieldParentId]);
            this.FunctionId = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldFunctionId]);
            this.CategoryId = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldCategoryId]);
            this.ObjectId = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldObjectId]);
            this.Title = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldTitle]);
            this.Content = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldContent]);
            this.ReceiverId = BusinessLogic.ConvertToInt(dataReader[CiMessageTable.FieldReceiverId]);
            this.ReceiverRealname = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldReceiverRealname]);
            this.IsNew = BusinessLogic.ConvertToInt(dataReader[CiMessageTable.FieldIsNew]);
            this.ReadCount = BusinessLogic.ConvertToInt(dataReader[CiMessageTable.FieldReadCount]);
            this.ReadDate = BusinessLogic.ConvertToDateTime(dataReader[CiMessageTable.FieldReadDate]);
            this.TargetURL = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldTargetURL]);
            this.IPAddress = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldIPAddress]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[CiMessageTable.FieldDeleteMark]);
            this.Enabled = BusinessLogic.ConvertToInt(dataReader[CiMessageTable.FieldEnabled]);
            this.Description = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldDescription]);
            this.SortCode = BusinessLogic.ConvertToInt(dataReader[CiMessageTable.FieldSortCode]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[CiMessageTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[CiMessageTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[CiMessageTable.FieldModifiedBy]);
            return this;
        }
    }
}
